<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta id="viewport" name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=no">
		<meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport" />
<script src="/static/home/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="/static/home/js/mui.min.js"></script>
<script type="text/javascript"> 
document.addEventListener( "plusready", onPlusReady, false );
// 扩展API加载完毕，现在可以正常调用扩展API 
function onPlusReady() { 
	mui.init({
	    gestureConfig:{
	        tap: true, //默认为true
	        doubletap: true, //默认为false
	        longtap: true, //默认为false
	        swipe: true, //默认为true
	        drag: true, //默认为true
	        hold:true,//默认为false，不监听
	        release:false//默认为false，不监听
	    }
	});
	document.getElementById("source_img").addEventListener('longtap',function(){
	    var imgurl = this.src;
	    var imgDtask = plus.downloader.createDownload(imgurl,{method:'GET'}, function (d,status) {
	            if(status == 200){
	                plus.gallery.save(d.filename, function(){
	                    plus.io.resolveLocalFileSystemURL(d.filename, function(res){
	                        mui('#picture').popover('toggle');
	                        mui.toast('保存成功');
	                    });

	                })
	            }else{
	                mui.toast('保存失败')
	            }
	      });
	    imgDtask.start();
	});
} 
</script>
		<title>我的专属海报</title>
		<style>
			.tui-head-box{text-align: center;}
			.tui-head-box span{text-decoration: none;padding: 10px 4px;margin: 0 10px;display: inline-block;color: #515151}
			.tui-head-box span.active{border-bottom: 2px solid #4E90E6;color: #4E90E6}
			.banner-hb-img{width: 78%;margin: 0 auto;}
			.banner-hb-img img{width: 100%;display: inline-block;vertical-align: top;margin-top: 6%;}
			.wm-p{color: #98A7B8;text-align: center;}
			.wm-p p{margin: 0;margin-top:6%;}
		</style>
	</head>
	<body>
		<div class="tuihb-box">
			<div class="tui-head-box">
			</div>
				<img id="source_img" src="/uploads/users/{$user.vid}.qrcode.png" alt="" width="100%"/>
			<div class="wm-p">
				<p>长按图片保存推广海报！</p>
				<p>Hi，朋友，为你介绍一款赚钱神器，让生活变得更小康!</p>
			</div>
		</div>
		<script type="text/javascript">
			$(".tui-head-box span").on("click",function(){
				$(this).siblings("span").toggleClass("active");
				$(this).toggleClass("active");
				var key = $(this).attr("data-id");
				console.log(key);
				//替换图片路径
				if(key!=1){
					//设置图片路径
					$(".banner-hb-img img").attr("src","/uploads/users/{$user.vid}.qrcode.png");
				}else{
					$(".banner-hb-img img").attr("src","/uploads/users/{$user.vid}.qrcode.png");
				}
			})
		</script>
	</body>
</html>
